
package data;

import java.io.Serializable;

/*
 * @author Γκαμπέρλο Ναϊμ
 * @author Μώτος Διονύσης
 * @author Παπαδημητρίου Δημήτρης
 * @author Παπαδόπουλος Αλέξανδρος p3080138
 * @author Παπαδόπουλος Λεωνίδας p3080139
 */

public class Offer implements Comparable<Offer>, Serializable {
    private String item;
    private float price;
    private String description;
/**
     * Offer Offer(String item,float price)
     * 
     * "Dimiourgia antikeimenou typoy Offer , me parametrous to                 
     *  item , price kai arxikopoiei to antikeimeno tipou Product"
     * @param item
     * @param price
     */

    public Offer(String item, float price){
        this.item = item;
        this.price = price;
    }
/**
     * Offer getItem()
     * 
     * "Epistrefei tin perigrafi tis antistoixis prosfora.O tipos pou epistrefei i sinartisi einai String"
     * @return String I prosfora
     */

    

    public String getItem() {
        return item;
    }

/**
     * Offer setItem(String item)
     * 
     * "Dimiourgia tis perigrafis tis antistoixis prosforas."
     * @param item
     *      */


    public void setItem(String item) {
        this.item = item;
    }

/**
     * Offer getPrice()
     * 
     * "Epistrefei tin timi tis antistoixis prosforas.I timi pou epistrefei einai tipou float"
     * @return float I timi tis prosforas
     */


    public float getPrice() {
        return price;
    }

/**
     * Offer setPrice(float price)
     * 
     * "Theti tin timi tis prosforas.I timi auti einai i parametros , i opoia einai tipou float"
     * @param price
     */


    public void setPrice(float price) {
        this.price = price;
    }

/**
     * Offer compareTo(Offer o)
     * 
     * "Sigkrini dio antikeimena tipou offer.(Xrisimi gia tajinomiseis sto OfferList)"
     * @param offer
     */


    public int compareTo(Offer o) {
        if (o.price == price) return 0;
        else if (o.price > price) return -1;
        else return 1;
    }
}
